<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>聊天室</title>
    <script type="text/javascript" src="/static/js/jquery-1.10.2.min.js"></script>
    <script type="text/javascript">
        $(document).ready(function(){
            //创建一个socket实例
            var socket = null; //初始为null
            socket = new WebSocket("ws://127.0.0.1:8282");
            socket.onmessage = function (ev) {
                console.log(ev);
            }
            $("#send").click(function () {
                socket.send('大家好');
            })
        });


    </script>
</head>
<body>
<span  id="send">发送</span>
</body>
</html>